package avicit.im.lantop.common.service.api;

import avicit.platform6.core.rest.msg.ResponseMsg;
import avicit.platform6.core.restclient.RestClient;
import avicit.platform6.core.restclient.RestClientUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class CommonManagerIntfsServiceApi {


    /**
     * 服务编码
     */
    private static final String SERVICE_CODE = "filebasicmanager";

    private static final String BASE_PATH = "/api/avicit/im/lantop/basic/archiveclassmanager/action/rest/CommonManagerIntfsServiceRest";

    @Autowired
    private RestClient restClient;



    public String getMenuNameByCodeByIntfs(String menuCode, String appId, String languageCode) {
        String url = BASE_PATH + "/getMenuNameByCodeByIntfs";
        Map<String,Object> map = new HashMap<>();
        map.put("menuCode",menuCode);
        map.put("appId",appId);
        map.put("languageCode",languageCode);
        ResponseMsg<String> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<String>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }
}
